import QtQuick 2.0
import QtQuick.Window 2.12
import QtQuick.Dialogs 1.2
Window{

    id: root

    property string box_text: "警告"
    property var tempData       // 缓存数据
    title: "提示"

    function setText(text){
        msgText.text = text
    }

    signal accept()
    signal reject()


    minimumHeight: 250*dp
    maximumHeight: 250*dp
    minimumWidth: 400*dp
    maximumWidth: 400*dp
    modality: Qt.WindowModal
    flags: Qt.Window | Qt.WindowTitleHint |Qt.WindowSystemMenuHint | Qt.WindowCloseButtonHint


    Image {
        x: 175*dp
        y: 30*dp
        id: name
        height: 50*dp
        width: 50*dp
        source: "qrc:/picture/msgWarning.png"
    }

    Text{
        height: 100*dp
        lineHeight: 1.3
        font.pixelSize: config.fontsize
        horizontalAlignment: TextInput.AlignHCenter
        wrapMode: Text.WordWrap
        width: parent.width-100*dp
        x: 50*dp
        y: 90*dp
        font.bold: true
        text: "提示"
    }

    Text {
        id: msgText
        lineHeight: 1.1
        font.pixelSize: config.fontsize
        anchors.centerIn: parent
        anchors.verticalCenterOffset: 13*dp
        wrapMode: Text.WordWrap
        horizontalAlignment: Text.AlignHCenter
        width: parent.width-80*dp
        color: "#999999"
        text: box_text
    }

    Item{
        height: 40*dp
        y: root.height - 80*dp
        width: root.width
        PushButton{
            x: root.width / 2 - 110*dp
            width: 100*dp
            title: "取消"
            defaultMode2: true
            onReleased: {
                root.reject()
                root.hide()
            }
        }
        PushButton{
            width: 100*dp
            x: root.width / 2 + 10*dp
            title: "确认"
            defaultMode1: true
            onReleased: {
                root.hide()
                root.accept()
            }
        }
    }


}
